DROP TABLE IF EXISTS dm.dm_collect_trace_dt;
CREATE EXTERNAL TABLE IF NOT EXISTS dm.dm_collect_trace_dt (
    waybill_no                    STRING    COMMENT '运单号',
    send_time                     TIMESTAMP COMMENT '发件扫描时间',
    arrival_time                  TIMESTAMP COMMENT '到件扫描时间',
    from_network_id               BIGINT    COMMENT '发件网点ID',
    from_network_code             STRING    COMMENT '发件网点编码',
    from_network_name             STRING    COMMENT '发件网点名称',
    from_network_type_id          BIGINT    COMMENT '发件网点类型',
    from_network_is_entrepot      INT       COMMENT '发件网点是否为集散点',
    to_network_id                 BIGINT    COMMENT '到件网点ID',
    to_network_code               STRING    COMMENT '到件网点编码',
    to_network_name               STRING    COMMENT '到件网点名称',
    to_network_type_id            BIGINT    COMMENT '到件网点类型',
    to_network_is_entrepot        INT       COMMENT '到件网点是否为集散点',
    shipment_no                   STRING    COMMENT '转运任务单号',
    line_id                       BIGINT    COMMENT '车线ID',
    line_code                     STRING    COMMENT '车线编码',
    line_name                     STRING    COMMENT '车线名称',
    shipment_load_time            TIMESTAMP COMMENT '装车时间',
    shipment_lock_time            TIMESTAMP COMMENT '锁车时间',
    shipment_arrival_time         TIMESTAMP COMMENT '车辆实际到达时间',
    shipment_planned_arrival_time TIMESTAMP COMMENT '车辆计划到达时间',
    step                          INT       COMMENT '第几次转运',
    full_step                     INT       COMMENT '集货流程总转运次数'
)
    COMMENT '集货转运明细表，T+1，每日回刷1天'
    PARTITIONED BY (dt STRING COMMENT '到达网点的最早日期 (yyyy-MM-dd)')
    STORED AS PARQUET
    LOCATION '/dw/hive/dm.db/china/oracle_jms_core/dm_collect_trace_dt'
    TBLPROPERTIES (
        'discover.partitions' = 'false',
        'parquet.column.index.access' = 'true'
        );

MSCK REPAIR TABLE dm.dm_collect_trace_dt;
